package com.mineoj.model.vo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.mineoj.model.entity.Solution;
import com.mineoj.model.entity.SolutionComment;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import java.io.Serializable;
import java.util.Date;

/**
 * 题解封装类

 */
@Data
public class SolutionCommentVO implements Serializable {

    /**
     * id
     */
    private Long id;

    /**
     * 题解 id
     */
    private Long solutionId;

    /**
     * 内容
     */
    private String content;

    /**
     * 创建用户 id
     */
    private Long userId;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 更新时间
     */
    private Date updateTime;

    /**
     * 创建用户信息
     */
    private UserVO userVO;


    /**
     * 包装类转对象
     *
     * @param solutionVO
     * @return
     */
    public static SolutionComment voToObj(SolutionCommentVO solutionVO) {
        if (solutionVO == null) {
            return null;
        }
        SolutionComment solutionComment = new SolutionComment();
        BeanUtils.copyProperties(solutionVO, solutionComment);

        return solutionComment;
    }

    /**
     * 对象转包装类
     *
     * @param solutionComment
     * @return
     */
    public static SolutionCommentVO objToVo(SolutionComment solutionComment) {
        if (solutionComment == null) {
            return null;
        }
        SolutionCommentVO solutionVO = new SolutionCommentVO();
        BeanUtils.copyProperties(solutionComment, solutionVO);

        return solutionVO;
    }

    private static final long serialVersionUID = 1L;
}